﻿/*
 * @Autor: PK
 * @Date: 2021-03-31 13:34:14
 * @Description: 读取CSV文件
 */

using ShkSimulation.core.dao.input.resource;
using ShkSimulation.core.util;

namespace ShkSimulation.core.dao.input.loader {
    
    public class ExcelResourceLoader : ResourceLoader {
        
        public Resource LoadData(string uniqueKey, string resourcePath) {
            return new DefaultDataTableResource(uniqueKey, FileUtil.LoadExcel(resourcePath), ResourceType.Excel, resourcePath);
        }

        public bool SaveData(Resource resource, string resourceInfo = null) {
            return FileUtil.SaveDataTableToExcel(resource.GetDataTable(), resourceInfo ?? resource.PathInfo);
        }
    }
}
